package com.gk.javaservice.service.impl;

import com.gk.javaservice.dao.ConfigDao;
import com.gk.javaservice.po.Config;
import com.gk.javaservice.service.ConfigService;
import com.gk.javaservice.util.time.TimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConfigServiceImpl implements ConfigService {

    @Autowired
    private ConfigDao baseDao;

    @Override
    public void add(Config baseBean) {
        String getTime = TimeUtil.dateFormat();
        baseBean.setCreatedAt(getTime);
        baseBean.setUpdatedAt(getTime);
        baseDao.add(baseBean);
    }

    @Override
    public Integer update(Config baseBean) {
        String getTime = TimeUtil.dateFormat();
        baseBean.setUpdatedAt(getTime);
        return baseDao.update(baseBean);
    }

    @Override
    public Integer delete(Object id) {
        return baseDao.delete(id);
    }

    @Override
    public List<Config> hasAll() {
        return baseDao.hasAll();
    }

    @Override
    public Config hasById(Object id) {
        return baseDao.hasById(id);
    }

    @Override
    public List<Config> hasAllToPage(int offset, int limit, String searchMsg) {
        return baseDao.hasAllToPage(offset,limit,searchMsg);
    }

    @Override
    public int queryTotal(String searchMsg) {
        return baseDao.queryTotal(searchMsg);
    }

    @Override
    public Config hasByKey(Object key) {
        return baseDao.hasByKey(key);
    }
}
